import pymysql

mysql_conn = pymysql.connect(host= '127.0.0.1', port= 3306, user= 'root', password= 'root', db= 'mysql')

sql = "select * from `user`"
try:
    with mysql_conn.cursor() as cursor:
        cursor.execute(sql)
        select_result = cursor.fetchone()
        print("sql result: ")
        print(select_result)

        for item in select_result:
            print(item)
except Exception as e:
    print(e)


mysql_conn.close()
